<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script src="/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/js/xadmin.js"></script>
    <script src="/js/jquery.min.js"></script>
</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <div class="layui-form layui-col-space5">
                        <div class="layui-input-inline layui-show-xs-block">
                            <select id="status" name="contrller">
                                <option value="" selected="selected">筛选状态</option>
                                <option value="1" <?php if ($status == 1) echo 'selected="selected"';?>>正常</option>
                                <option value="2" <?php if ($status == 2) echo 'selected="selected"';?>>回收站</option>
                            </select>

                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  id="search" ><i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </div>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th></th>
                            <th>评论Id</th>
                            <th>商品Id</th>
                            <th>评论内容</th>
                            <th>用户名</th>
                            <th>发布时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach ($commentList as $row): ?>
                            <tr>
                                <td>
                                    <input type="checkbox" name="" lay-skin="primary">
                                </td>
                                <td><?php echo $row['comment_id']; ?></td>
                                <td><?php echo $row['ware_id']; ?></td>
                                <td><?php echo $row['comment_content']; ?></td>
                                <td><?php echo $row['user_name']; ?></td>
                                <td><?php echo date("Y-m-d H:i:s", $row['add_time']); ?></td>
                                <td class="td-manage">
                                    <?php if ($row['status'] == 1): ?>
                                        <a title="移入回收站" onclick="xadmin.open('移入回收站','/index.php?s=admin/comment/garbage/comment_id/<?php echo $row['comment_id']; ?>')" href="javascript:;">
                                            <i class="layui-icon">&#xe640;</i>
                                        </a>
                                    <?php elseif ($row['status'] == 2): ?>
                                        <a title="恢复" onclick="xadmin.open('恢复','/index.php?s=/admin/comment/resume/comment_id/<?php echo $row['comment_id']; ?>')" href="javascript:;">
                                            <i class="icon iconfont"></i>
                                        </a>
                                        <a title="彻底删除" onclick="xadmin.open('删除','/index.php?s=/admin/comment/delete/comment_id/<?php echo $row['comment_id']; ?>')" href="javascript:;">
                                            <i class="layui-icon">&#xe640;</i>
                                        </a>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                            <a class="prev" href="">&lt;&lt;</a>
                            <a class="num" href="">1</a>
                            <span class="current">2</span>
                            <a class="num" href="">3</a>
                            <a class="next" href="">&gt;&gt;</a></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $("#search").click(function () {
        //按照状态删选评论列表数据
        let status = $("#status").val();
        let url = "/admin/comment/index/status/"+status+"/";
        location.href = url;
    });
</script>
<script>layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

   </script>
</html>